package ai.weed.qrcode.service;

import ai.weed.qrcode.domain.WxUser;
import ai.weed.qrcode.mapper.WxUserMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 微信用户服务
 *
 * @author zhong.wang
 * @date 2025/10/30
 **/
@Service
public class WxUserService {

    @Resource
    private WxUserMapper wxUserMapper;

    /**
     * 根据 openid 查询用户
     * @param openid
     * @return
     */
    public WxUser getByOpenid(String openid) {
        return wxUserMapper.getByOpenid(openid);
    }

    /**
     * 保存用户
     * @param user
     */
    public void save(WxUser user) {
        wxUserMapper.insert(user);
    }
}
